﻿using Microsoft.AspNetCore.Http;
using System.Security.Claims;

namespace B.S.BaseData.Api.Write.GetCelim
{
    public class IdContextCemil : IIdContextCemil
    {
        private readonly IHttpContextAccessor _contextAccessor;

        public IdContextCemil(IHttpContextAccessor contextAccessor)
        {
            _contextAccessor = contextAccessor;
            this.UserId = _contextAccessor.HttpContext.User.FindFirstValue("UserId");
            this.UserName = _contextAccessor.HttpContext.User.FindFirstValue("UserName");
            this.RoleName = _contextAccessor.HttpContext.User.FindFirstValue("RoleName");
        }

        public string UserId { get; set; }
        public string UserName { get; set; }
        public string RoleName { get; set; }
    }
    public interface IIdContextCemil
    {
        public string UserId { get; set; }
        public string UserName { get; set; }
        public string RoleName { get; set; }
    }
}
